define(["../com"], function() {
	
	var $list = $(".points-page");
	$list.parseHtml().empty();
	loadList();
	
	function loadList() {
		$.get(g_domain + "/car?r=" + Math.random(), function(data) {
			if (data.status !== 0) {
				data.code == "0" ? void(0) : alert(data.message);
				return;
			}
			var list = data.result.list;
			if (!list || list.length == 0) {
				alert("您还没有任何车辆，请先绑定");
				location.href = "bind.html";
				return;
			}
			$list.empty().parseHtml({
				data: data.result.list,
				afterNode: {
					root: function(item) {
						$.get(g_domain + "/user/qryvip?carNo=" + item.carNo + "&r=" + Math.random(), function(data) {
							if (data.status !== 0) {
								data.code == "0" ? void(0) : alert(data.message);
								return;
							}
							var apiRes = $.parseJSON(data.result).response;
							$("#integral_" + item.carId).html(apiRes[0].BalanceIntegral);
							$("#amount_" + item.carId).html(apiRes[0].TotalAmount);

						});
					}
				}
			});
			
		});
	}
	
});